package Zim::Formats::XML;

use strict;

our $VERSION = '0.01';

=head1 NAME

Zim::Format::XML - XML backend for zim

=head1 DESCRIPTION

FIXME descriptve text

=head1 METHODS

=over 4

=item C<load_tree(IO PAGE)>

=cut

my %ents = (
	'lt'   => '<',
	'gt'   => '>',
	'amp'  => '&',
	'apos' => '\'',
	'quot' => '"',
);
my $ents_reg = qr/\&(lt|gt|amp|apos|quot);/;
# $text =~ s/$ents_reg/$ent{$1}/g;

my %chars = reverse %ents;
my $chars_reg = qr/(<|>|&|'|")/;

sub load_tree {
	my ($class, $io, $page) = @_;

	my $root = [];
	my @stack = ($root);
	my $buffer = '';
	while (<$io>) {
		$buffer .= $_;
		while ($buffer =~ s/^(.*?)(<.*?>)//) {
			push @{$stack[-1]}, $1;
			$2 =~ /^<\s*(\S+)\s*(.*?)\s*(\/)\s*>$/;
			my ($tag, $meta, $end) = ($1, $2, $3);
			
		}
	}
}

=item C<save_tree(IO, TREE, PAGE)>

=cut

sub save_tree {
}

1;

__END__

=back

=head1 AUTHOR

Jaap Karssenberg (Pardus) E<lt>pardus@cpan.orgE<gt>

Copyright (c) 2006 Jaap G Karssenberg. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

=cut

